package cn.csg.iotplatform.module.system.dal.mysql.dvdeviceattachment;

import java.util.*;

import cn.csg.iotplatform.framework.common.pojo.PageResult;
import cn.csg.iotplatform.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csg.iotplatform.framework.mybatis.core.mapper.BaseMapperX;
import cn.csg.iotplatform.module.system.controller.admin.dvdeviceattachment.vo.DvDeviceAttachmentPageReqVO;
import cn.csg.iotplatform.module.system.dal.dataobject.dvdeviceattachment.DvDeviceAttachmentDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 设备中心共库专用附件 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface DvDeviceAttachmentMapper extends BaseMapperX<DvDeviceAttachmentDO> {

    default PageResult<DvDeviceAttachmentDO> selectPage(DvDeviceAttachmentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DvDeviceAttachmentDO>()
                .eqIfPresent(DvDeviceAttachmentDO::getFlagId, reqVO.getFlagId())
                .eqIfPresent(DvDeviceAttachmentDO::getCertificatesType, reqVO.getCertificatesType())
                .eqIfPresent(DvDeviceAttachmentDO::getCertificatesLevel, reqVO.getCertificatesLevel())
                .eqIfPresent(DvDeviceAttachmentDO::getCertificatesCode, reqVO.getCertificatesCode())
                .eqIfPresent(DvDeviceAttachmentDO::getAttachmentId, reqVO.getAttachmentId())
                .eqIfPresent(DvDeviceAttachmentDO::getCreatorId, reqVO.getCreatorId())
                .likeIfPresent(DvDeviceAttachmentDO::getCreatorName, reqVO.getCreatorName())
                .likeIfPresent(DvDeviceAttachmentDO::getFileName, reqVO.getFileName())
                .eqIfPresent(DvDeviceAttachmentDO::getFileType, reqVO.getFileType())
                .eqIfPresent(DvDeviceAttachmentDO::getJobTypeCode, reqVO.getJobTypeCode())
                .eqIfPresent(DvDeviceAttachmentDO::getObjectId, reqVO.getObjectId())
                .eqIfPresent(DvDeviceAttachmentDO::getFlag, reqVO.getFlag())
                .eqIfPresent(DvDeviceAttachmentDO::getBureauCode, reqVO.getBureauCode())
                .eqIfPresent(DvDeviceAttachmentDO::getOptimisticLockVersion, reqVO.getOptimisticLockVersion())
                .eqIfPresent(DvDeviceAttachmentDO::getProvinceCode, reqVO.getProvinceCode())
                .eqIfPresent(DvDeviceAttachmentDO::getDataFrom, reqVO.getDataFrom())
                .eqIfPresent(DvDeviceAttachmentDO::getRemark, reqVO.getRemark())
                .orderByDesc(DvDeviceAttachmentDO::getId));
    }

    List<DvDeviceAttachmentDO> getAttachmentByManuId(String manuId);

    List<DvDeviceAttachmentDO> getAttachments(@Param("manuId") String manuId, @Param("jobTypeCode")  String jobTypeCode);

    List<DvDeviceAttachmentDO> getDeleteAttachments(@Param("ids") List<String> ids, @Param("manuId") String manuId);

    DvDeviceAttachmentDO getAttachment(@Param("flagId") String flagId, @Param("fullPath")  String fullPath, @Param("jobTypeCode") String jobTypeCode);
}